<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">















 
 
 
 
 
 
 
  
  


<html>
  <head>
    <script type="text/javascript" language="JavaScript">
    ORIGINAL_PAGE_PATH = "/appengine/docs/python/tools/devserver.html";
    </script>
    
    
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>The Python Development Server - Google App Engine - Google Code</title>
<script type="text/javascript"><!--
(function(){function a(){this.t={};this.tick=function(c){this.t[c]=(new Date).getTime()};this.tick("start")}var b=new a;window.jstiming={Timer:a,load:b};if(window.external&&window.external.pageT)window.jstiming.pt=window.external.pageT;})();

var _tocPath_ = '/appengine/docs/_toc.ezt';
var codesite_token = null;
//--></script>
<link href="../../../../css/codesite.pack.04102009.css" type="text/css" rel="stylesheet"></link>
<script src="../../../../js/codesite_head.pack.04102009.js" type="text/javascript"></script>
<script type="text/javascript">CODESITE_CSITimer['load'].tick('bhs');</script>
<link rel="search" type="application/opensearchdescription+xml" title="Google Code" href="http://code.google.com/osd.xml" />

<!--[if IE]><link rel="stylesheet" type="text/css" href="../../../../css/iehacks.css" /><![endif]-->

    <link href="../../../../css/semantic_headers.css" rel="stylesheet" type="text/css" />
    <link href="../../../css/local_extensions.css" rel="stylesheet" type="text/css" />
  </head>

  <body class="gc-documentation">

    
    
    
</a>

<div id="gb">
 <span>
  
    <a id="lang-dropdown" class="dropdown" href="http://code.google.com" onclick="return false;"><img class="globeicon" src="../../../../images/globe2_small.png"/><span>English</span></a>
  
 </span>
</div>

<div class="gbh" style="left: 0pt;"></div>
<div class="gbh" style="right: 0pt;"></div>


<style type="text/css">
  #gc-topnav h1 {
    padding: 0 0 0 6px;
  }
</style>


<div id="gc-container">
<a name="top"></a>
<div id="skipto">
  <a href="#gc-pagecontent">Skip to page content</a>
  <a href="#gc-toc">Skip to main navigation</a>
</div>

<div id="gc-header">
  <div id="logo"><a href="http://code.google.com">
  
  
     <img src="../../../../images/cleardot.gif" height="1px" width="1px" alt="Google Code Home Page" id="gc-logo-img"/>
  
  
  </a></div>
  <div id="search">
    <div id="searchForm" class="searchForm">
      <form id="cse" action="http://www.google.com/cse" accept-charset="utf-8" class="gsc-search-box" onsubmit="executeGSearch(document.getElementById('gsearchInput').value); return false;">
      <noscript>
      <input type="hidden" name="cref" value="http://code.google.com/cse/googlecode-context.xml"/>
      </noscript>
        <table class="gsc-search-box" cellpadding="0" cellspacing="0">
          <tbody>
            <tr>
              <td class="gsc-input">
                <input id="gsearchInput" type="text" name="q" maxlength="2048" class="gsc-input" autocomplete="off" title="Google Code Search" style="width:345px"/>
              </td>
              <td class="gsc-search-button">
                <div id="cs-searchresults" onclick="event.cancelBubble = true;"></div>
                <input title="Search" id="gsearchButton" class="gsc-search-button" name="sa" value="Search" type="submit"/>
              </td>
            </tr>
            <tr>
              <td colspan="2" class="greytext">e.g. "templates" or "datastore"</td>
            </tr>
          </tbody>
        </table>
      </form>
    </div> <!-- end searchForm -->
  </div> <!-- end search -->
</div> <!-- end gc-header -->


<div id="codesiteContent">

<a name="gc-topnav-anchor"></a>
<div id="gc-topnav">
  <h1>Google App Engine</h1>
  <ul id="docs" class="gc-topnav-tabs">

    <li id="home_link">
      <a href="../../../index.html" title="Google App Engine home page">Home</a>
    </li>
  
    <li id="docs_link">
      <a href="../../index.html" class="selected" title="Official Google App Engine documentation">Docs</a>
    </li>
  
    <li id="faq_link">
      <a href="../../../kb/index.html" title="Answers to frequently asked questions about Google App Engine">FAQ</a>
    </li>
  
    <li id="articles_link">
      <a href="../../../articles/index.html" title="Focused articles and tutorials for Google App Engine developers">Articles</a>
    </li>
  
    <li>
      <a href="http://googleappengine.blogspot.com/" title="Official Google App Engine blog">Blog</a>
    </li>
  
    <li>
      <a href="../../../community.html" title="Community home for Google App Engine">Community</a>
    </li>
  
    <li>
      <a href="../../../terms.html" title="Google App Engine terms of service">Terms</a>
    </li>
  
    <li>
      <a href="../../../downloads.html" title="Download Google App Engine">Download</a>
    </li>
  

  </ul>
</div> <!-- end gc-topnav -->

    <div class="g-section g-tpl-170">

      <div class="g-unit g-first" id="gc-toc">
        <ul>
  <li><a href="../../../downloads.html">Downloads</a></li>
  <li><a href="http://code.google.com/status/appengine">System Status</a></li>
  <li><a href="http://code.google.com/p/googleappengine/issues/list">Issue Tracker</a></li>
</ul>
<div class="line"></div>
<ul>
  <li><h2>Getting Started</h2>
    <ul>
      <li><a href="../../whatisgoogleappengine.html">What Is Google App Engine?</a></li>
      <li><a href="../../java/gettingstarted/index.html">Java</a>
        <ul>
              <li><a href="../../java/gettingstarted/introduction.html">Introduction</a></li>
    <li><a href="../../java/gettingstarted/installing.html">Installing the Java SDK</a></li>
    <li><a href="../../java/gettingstarted/creating.html">Creating a Project</a></li>
    <li><a href="../../java/gettingstarted/usingusers.html">Using the Users Service</a></li>
    <li><a href="../../java/gettingstarted/usingjsps.html">Using JSPs</a></li>
    <li><a href="../../java/gettingstarted/usingdatastore.html">Using the Datastore with JDO</a></li>
    <li><a href="../../java/gettingstarted/staticfiles.html">Using Static Files</a></li>
    <li><a href="../../java/gettingstarted/uploading.html">Uploading Your Application</a></li>

        </ul>
      </li>
      <li><a href="../gettingstarted/index.html">Python</a>
        <ul>
            <li><a href="../gettingstarted/introduction.html">Introduction</a></li>
  <li><a href="../gettingstarted/devenvironment.html">The Development Environment</a></li>
  <li><a href="../gettingstarted/helloworld.html">Hello, World!</a></li>
  <li><a href="../gettingstarted/usingwebapp.html">Using the webapp Framework</a></li>
  <li><a href="../gettingstarted/usingusers.html">Using the Users Service</a></li>
  <li><a href="../gettingstarted/handlingforms.html">Handling Forms With webapp</a></li>
  <li><a href="../gettingstarted/usingdatastore.html">Using the Datastore</a></li>
  <li><a href="../gettingstarted/templates.html">Using Templates</a></li>
  <li><a href="../gettingstarted/staticfiles.html">Using Static Files</a></li>
  <li><a href="../gettingstarted/uploading.html">Uploading Your Application</a></li>

        </ul>
      </li>
    </ul>
  </li>
</ul>
<div class="line"></div>
<ul>
  <li><h2>Java <sup class="new">Early Look</sup></h2>
    <ul>
          <li><a href="../../java/overview.html">Overview</a></li>
    <li><a href="../../java/runtime.html">Servlet Environment</a></li>
    <li><a href="../../java/datastore/index.html">Storing Data</a>
      <ul>
            <li><a href="../../java/datastore/overview.html">Overview</a></li>
    <li><a href="../../java/datastore/usingjdo.html">Using JDO</a></li>
    <li><a href="../../java/datastore/dataclasses.html">Defining Data Classes</a></li>
    <li><a href="../../java/datastore/creatinggettinganddeletingdata.html">Creating, Getting and Deleting Data</a></li>
    <li><a href="../../java/datastore/queriesandindexes.html">Queries and Indexes</a></li>
    <li><a href="../../java/datastore/transactions.html">Transactions</a></li>
    <li><a href="../../java/datastore/relationships.html">Relationships</a></li>
    <li><a href="../../java/datastore/usingjpa.html">Using JPA</a></li>
    <li><a href="../../java/javadoc/com/google/appengine/api/datastore/package-summary.html">Low-level API</a></li>

      </ul>
    </li>
    <li><a href="../../java/apis.html">Services</a>
      <ul>
        <li><a href="../../java/memcache/index.html">Memcache</a>
          <ul>
                <li><a href="../../java/memcache/overview.html">Overview</a></li>
    <li><a href="../../java/memcache/usingjcache.html">Using JCache</a></li>
    <li><a href="../../java/javadoc/com/google/appengine/api/memcache/package-summary.html">Low-level API</a></li>

          </ul>
        </li>
        <li><a href="../../java/urlfetch/index.html">URL Fetch</a>
          <ul>
                <li><a href="../../java/urlfetch/overview.html">Overview</a></li>
    <li><a href="../../java/urlfetch/usingjavanet.html">Using java.net</a></li>
    <li><a href="../../java/javadoc/com/google/appengine/api/urlfetch/package-summary.html">Low-level API</a></li>

          </ul>
        </li>
        <li><a href="../../java/mail/index.html">Mail</a>
          <ul>
                <li><a href="../../java/mail/overview.html">Overview</a></li>
    <li><a href="../../java/mail/usingjavamail.html">Using JavaMail</a></li>
    <li><a href="../../java/javadoc/com/google/appengine/api/mail/package-summary.html">Low-level API</a></li>

          </ul>
        </li>
        <li><a href="../../java/images/index.html">Images</a>
          <ul>
                <li><a href="../../java/images/overview.html">Overview</a></li>
    <li><a href="../../java/javadoc/com/google/appengine/api/images/package-summary.html">API Reference</a></li>

          </ul>
        </li>
        <li><a href="../../java/users/index.html">Google Accounts</a>
          <ul>
                <li><a href="../../java/users/overview.html">Overview</a></li>
    <li><a href="../../java/javadoc/com/google/appengine/api/users/package-summary.html">API Reference</a></li>

          </ul>
        </li>
      </ul>
    </li>
    <li><a href="../../java/javadoc/index.html">Javadoc Reference</a></li>
    <li><a href="../../java/jrewhitelist.html">JRE Class White List</a></li>
    <li><a href="../../java/config/index.html">Configuration</a>
      <ul>
            <li><a href="../../java/config/webxml.html">Deployment Descriptor</a></li>
    <li><a href="../../java/config/appconfig.html">App Config</a></li>
    <li><a href="../../java/config/indexconfig.html">Index Config</a></li>
    <li><a href="../../java/config/cron.html">Scheduled Tasks</a></li>

      </ul>
    </li>
    <li><a href="../../java/tools/index.html">Tools</a>
      <ul>
            <li><a href="../../java/tools/devserver.html">Development Server</a></li>
    <li><a href="../../java/tools/uploadinganapp.html">Uploading and Managing</a></li>
    <li><a href="../../java/tools/eclipse.html">Google Plugin for Eclipse</a></li>
    <li><a href="../../java/tools/ant.html">Using Apache Ant</a></li>

      </ul>
    </li>
    <li><a href="../../java/howto/index.html">How-To</a>
      <ul>
              <li><a href="../../java/howto/unittesting.html">Unit Testing</a></li>

      </ul>
    </li>

    </ul>
  </li>
</ul>
<div class="line"></div>
<ul>
  <li><h2>Python</h2>
    <ul>
          <li><a href="../overview.html">Overview</a></li>
    <li><a href="../runtime.html">CGI Environment</a></li>
    <li><a href="../datastore/index.html">Storing Data</a>
      <ul>
             <li><a href="../datastore/overview.html">Overview</a></li>
     <li><a href="../datastore/entitiesandmodels.html">Entities and Models</a></li>
     <li><a href="../datastore/creatinggettinganddeletingdata.html">Creating, Getting and Deleting Data</a></li>
     <li><a href="../datastore/keysandentitygroups.html">Keys and Entity Groups</a></li>
     <li><a href="../datastore/queriesandindexes.html">Queries and Indexes</a></li>
     <li><a href="../datastore/transactions.html">Transactions</a></li>
     <li><a href="../datastore/typesandpropertyclasses.html">Types and Property Classes</a></li>
     <li><a href="../datastore/gqlreference.html">GQL Reference</a></li>

     <li><span class="tlw-title tlw-expanded">Reference</span>
       <ul>
         <li><a href="../datastore/modelclass.html">Model</a></li>
         <li><a href="../datastore/expandoclass.html">Expando</a></li>
         <li><a href="../datastore/polymodelclass.html">PolyModel</a></li>
         <li><a href="../datastore/propertyclass.html">Property</a></li>
         <li><a href="../datastore/queryclass.html">Query</a></li>
         <li><a href="../datastore/gqlqueryclass.html">GqlQuery</a></li>
         <li><a href="../datastore/keyclass.html">Key</a></li>
         <li><a href="../datastore/functions.html">Functions</a></li>
         <li><a href="../datastore/exceptions.html">Exceptions</a></li>
       </ul>
     </li>

      </ul>
    </li>
    <li><a href="../apis.html">Services</a>
      <ul>
        <li><a href="../memcache/index.html">Memcache</a>
          <ul>
                 <li><a href="../memcache/overview.html">Overview</a></li>
      <li><a href="../memcache/usingmemcache.html">Using Memcache</a></li>
     <li><span class="tlw-title tlw-expanded">Reference</span>
       <ul>
         <li><a href="../memcache/clientclass.html">Client</a></li>
         <li><a href="../memcache/functions.html">Functions</a></li>
       </ul>
     </li>

          </ul>
        </li>
        <li><a href="../urlfetch/index.html">URL Fetch</a>
          <ul>
                 <li><a href="../urlfetch/overview.html">Overview</a></li>
     <li><span class="tlw-title tlw-expanded">Reference</span>
       <ul>
         <li><a href="../urlfetch/fetchfunction.html">The fetch Function</a></li>
         <li><a href="../urlfetch/responseobjects.html">Response Objects</a></li>
         <li><a href="../urlfetch/exceptions.html">Exceptions</a></li>
       </ul>
     </li>

          </ul>
        </li>
        <li><a href="../mail/index.html">Mail</a>
          <ul>
                 <li><a href="../mail/overview.html">Overview</a></li>
     <li><a href="../mail/sendingmail.html">Sending Mail</a></li>
     <li><a href="../mail/attachments.html">Attachments</a></li>
     <li><span class="tlw-title tlw-expanded">Reference</span>
       <ul>
         <li><a href="../mail/emailmessageclass.html">EmailMessage</a></li>
         <li><a href="../mail/emailmessagefields.html">Message Fields</a></li>
         <li><a href="../mail/functions.html">Functions</a></li>
         <li><a href="../mail/exceptions.html">Exceptions</a></li>
       </ul>
     </li>

          </ul>
        </li>
        <li><a href="../images/index.html">Images</a>
          <ul>
                 <li><a href="../images/overview.html">Overview</a></li>
     <li><a href="../images/installingPIL.html">Installing PIL</a></li>
     <li><a href="../images/usingimages.html">Using the Images API</a></li>
     <li><span class="tlw-title tlw-expanded">Reference</span>
       <ul>
         <li><a href="../images/imageclass.html">Image</a></li>
         <li><a href="../images/functions.html">Functions</a></li>
         <li><a href="../images/exceptions.html">Exceptions</a></li>
       </ul>
     </li>

          </ul>
        </li>
        <li><a href="../users/index.html">Google Accounts</a>
          <ul>
                 <li><a href="../users/overview.html">Overview</a></li>
     <li><a href="../users/userobjects.html">User Objects</a></li>
     <li><a href="../users/loginurls.html">Login URLs</a></li>
     <li><a href="../users/adminusers.html">Admin Users</a></li>

     <li><span class="tlw-title tlw-expanded">Reference</span>
       <ul>
         <li><a href="../users/userclass.html">User</a></li>
         <li><a href="../users/functions.html">Functions</a></li>
         <li><a href="../users/exceptions.html">Exceptions</a></li>
       </ul>
     </li>

          </ul>
        </li>
      </ul>
    </li>
    <li><a href="../config/index.html">Configuration</a>
      <ul>
            <li><a href="../config/appconfig.html">App Config</a></li>
    <li><a href="../config/indexconfig.html">Index Config</a></li>
    <li><a href="../config/cron.html">Scheduled Tasks</a></li>

      </ul>
    </li>
    <li><a href="index.html">Tools</a>
      <ul>
            <li><a href="devserver.html">Development Server</a></li>
    <li><a href="uploadinganapp.html">Uploading and Managing</a></li>
    <li><a href="uploadingdata.html">Uploading Data</a></li>
    <li><a href="webapp/index.html">webapp Framework</a>
      <ul>
             <li><a href="webapp/overview.html">Overview</a></li>
     <li><a href="webapp/running.html">Running the Application</a></li>
     <li><a href="webapp/requesthandlers.html">Request Handlers</a></li>
     <li><a href="webapp/requestdata.html">Request Data</a></li>
     <li><a href="webapp/buildingtheresponse.html">Building the Response</a></li>
     <li><a href="webapp/redirects.html">Redirects, Headers and Status Codes</a></li>
     

     <li><span class="tlw-title tlw-expanded">Reference</span>
       <ul>
         <li><a href="webapp/requestclass.html">Request</a></li>
         <li><a href="webapp/responseclass.html">Response</a></li>
         <li><a href="webapp/requesthandlerclass.html">RequestHandler</a></li>
         <li><a href="webapp/wsgiapplicationclass.html">WSGIApplication</a></li>
         <li><a href="webapp/utilmodule.html">Utility Functions</a></li>
         
       </ul>
     </li>

      </ul>
    </li>
    <li><a href="libraries.html">Third-party Libraries</a></li>

      </ul>
    </li>
    <li><a href="../howto/index.html">How-To</a>
      <ul>
              <li><a href="../howto/usinggdataservices.html">Google Data Services</a></li>

      </ul>
    </li>

    </ul>
  </li>
</ul>
<div class="line"></div>
<ul>
  <li><h2>Managing Your App</h2>
    <ul>
      <li><a href="../../theadminconsole.html">The Admin Console</a></li>
      <li><a href="../../quotas.html">Quotas</a></li>
      <li><a href="../../billing.html">Billing</a></li>
    </ul>
  </li>
</ul>
<div class="line"></div>
<ul>
  <li><h2>Resources</h2>
    <ul>
      <li><a href="../../../kb/index.html">FAQ</a></li>
      <li><a href="../../../articles/index.html">Articles</a></li>
      <li><a href="http://appengine-cookbook.appspot.com/">Cookbook</a></li>
      <li><a href="http://appgallery.appspot.com/">App Gallery</a></li>
      <li><a href="http://code.google.com/p/googleappengine/">SDK Code</a></li>
      <li><a href="http://code.google.com/p/google-app-engine-samples/">Sample Apps Code</a></li>
      <li><a href="../../../community.html">Discussion Groups</a></li>
    </ul>
  </li>
</ul>
<div class="line"></div>
<ul>
  <li><a href="../../roadmap.html">Product Roadmap</a></li>
  <li><a href="http://code.google.com/p/googleappengine/wiki/SdkReleaseNotes">Release Notes</a></li>
  <li><a href="../../revision_history.html">Revision History</a></li>
</ul>

        <a class="hidden" href="#gc-topnav-anchor">More Google App Engine resource links</a>
      </div>

      <div class="g-unit" id="gc-pagecontent">
        <h1 class="page_title">The Python Development Server</h1>



<p>The App Engine Python SDK includes a web server application you can run on your computer that simulates your application running in the App Engine Python runtime environment.  The simulated environment enforces some sandbox restrictions, such as restricted system functions and Python module imports, but not others, like request time-outs or quotas.  The server also simulates the services by performing their tasks locally.</p>

<ul>
  <li><a href="#Running_the_Development_Web_Server">Running the Development Web Server</a></li>
  <li><a href="#Using_the_Datastore">Using the Datastore</a></li>
  <li><a href="#Using_Users">Using Users</a></li>
  <li><a href="#Using_Mail">Using Mail</a></li>
  <li><a href="#Using_URL_Fetch">Using URL Fetch</a></li>
  <li><a href="#The_Development_Console">The Development Console</a></li>
  <li><a href="#Command_Line_Arguments">Command-Line Arguments</a></li>
</ul>


<h2 id="Running_the_Development_Web_Server">Running the Development Web Server</h2>

<p>Once you have a directory for your application and an <a href="../config/appconfig.html">app.yaml</a> configuration file, you can start the development web server with the <code>dev_appserver.py</code> command:</p>

<pre>
dev_appserver.py myapp
</pre>

<p>The web server listens on port 8080 by default.  You can visit the application at this URL: <a href="http://localhost:8080/">http://localhost:8080/</a></p>

<p>To change which port the web server uses, use the <code>--port</code> option:</p>

<pre>
dev_appserver.py --port=9999 myapp
</pre>

<p>To stop the web server: With Windows, press Control-Break in your command prompt window.  With Mac OS X or Unix, press Control-C.</p>

<p>While it is running, the web server watches for changes you make to your files, and reloads them if needed.  For most kinds of changes, you can simply edit files, then reload the web page in your browser.  Under certain circumstances, such as if the application does dynamic imports, you may need to restart the web server to reset module import caching.</p>

<p>Be sure to run <code>dev_appserver.py</code> using Python 2.5.  It will run under Python 2.4, but there are differences between Python 2.4 and 2.5 that may affect your application, such as handling of Unicode strings.</p>


<h2 id="Using_the_Datastore">Using the Datastore</h2>

<p>The development web server simulates the App Engine datastore using a file on your computer.  This file persists between invocations of the web server, so data you store will still be available the next time you run the web server.</p>

<p>To clear the local datastore for an application, use the <code>--clear_datastore</code> option when you start the web server:</p>

<pre>
dev_appserver.py --clear_datastore myapp
</pre>

<p>The web server prints the location of the datastore file it is using to the terminal when it starts up.  You can make a copy of the file, then restore them later to reset the datastore to a known state.  Be sure to restart the web server after replacing the datastore file.</p> 

<p>To change the location used for the datastore file, use the <code>--datastore_path</code> option:</p>

<pre>
dev_appserver.py --datastore_path=/tmp/myapp_datastore myapp
</pre>

<p>When your application performs a query on the datastore, the development web server checks that the query is supported by the application's <code>index.yaml</code> file.  If the query requires that its index be mentioned in the file, the server generates one and adds it to the file.  You may want to edit this file if your application may attempt queries that are not exercised by your tests.</p>

<p><code>index.yaml</code> is generated from every query made since the datastore file was created or last cleared.  The query history is stored in a separate file.  To change the location of the history file, use the <code>--history_path</code> option similarly to the <code>--datastore_path</code> option.</p>

<p>For more information on indexes and <code>index.yaml</code>, see <a href="../datastore/queriesandindexes.html">Queries and Indexes</a>, and <a href="../config/indexconfig.html">Configuring Indexes</a>.</p>


<h2 id="Using_Users">Using Users</h2>

<p>The development web server simulates Google Accounts with its own sign-in and sign-out pages.  While running under the development web server, the <a href="../users/functions.html#create_login_url">users.create_login_url</a> and <a href="../users/functions.html#create_logout_url">users.create_logout_url</a> functions return URLs for <code>/_ah/login</code> and <code>/_ah/logout</code> on the local server.</p>

<p>The development sign-in page includes a form where you can enter an email address.  Your session uses whatever email address you enter as the active user.</p>

<p>To have the application believe that the logged-in user is an administrator, check the  checkbox on the form.</p>


<h2 id="Using_Mail">Using Mail</h2>

<p>The development web server can send email for calls to the App Engine mail service.  To enable email support, the web server must be given options that specify a mail server to use.  The web server can use an SMTP server, or it can use a local installation of <a href="http://www.sendmail.org/">Sendmail</a>.</p>

<p>To enable mail support with an SMTP server, use the <code>--smtp_host</code>, <code>--smtp_port</code>, <code>--smtp_user</code> and <code>--smtp_password</code> options with the appropriate values.</p>

<pre>
dev_appserver.py --smtp_host=smtp.example.com --smtp_port=25 \
    --smtp_user=ajohnson --smtp_password=k1tt3ns myapp
</pre>

<p>To enable mail support with Sendmail, use the <code>--enable_sendmail</code> option.  The web server will use the <code>sendmail</code> command to send email messages, with your installation's default configuration.</p>

<pre>
dev_appserver.py --enable_sendmail myapp
</pre>

<p>If mail is not enabled with either SMTP or Sendmail, then attempts to send email from the application will do nothing, and appear successful in the application.</p> 


<h2 id="Using_URL_Fetch">Using URL Fetch</h2>

<p>When your application uses the URL fetch API to make an HTTP request, the development web server makes the request directly from your computer.  The behavior may differ from when your application runs on App Engine if you use a proxy server for accessing websites.</p>

<p class="note"><b>Note:</b> <code>dev_appserver.py</code> can only serve one request at a time.  If your application makes URL fetch requests to itself while processing a request, these requests will fail when using the development web server.  (They will not fail when running on App Engine.)  To test such requests, you can run a second instance of <code>dev_appserver.py</code> on a different port, then code your application to use the other server when making requests to itself.</p>


<h2 id="The_Development_Console">The Development Console</h2>

<p>The development web server includes a console web application.  With the console, you can browse the local datastore, and interact with the application by submitting Python code to a web form.</p>



<p>To access the console, visit the URL <code>/_ah/admin</code> on your server: <a href="http://localhost:8080/_ah/admin">http://localhost:8080/_ah/admin</a></p>




<h2 id="Command_Line_Arguments">Command-Line Arguments</h2>

<p>The <code>dev_appserver.py</code> command supports the following command-line arguments:</p>

<dl>
  <dt><code>--datastore_path=<i>...</i></code></dt>
  <dd>
    <p>The path to use for the local datastore data file.  The server creates this file if it does not exist.</p>
  </dd>

  <dt><code>--history_path=<i>...</i></code></dt>
  <dd>
    <p>The path to use for the local datastore history file.  The server uses the query history file to generate entries for <code>index.yaml</code>.</p>
  </dd>

  <dt><code>--debug</code></dt>
  <dd>
    <p>Prints verbose debugging messages to the console while running.</p>
  </dd>

  <dt><code>--help</code></dt>
  <dd>
    <p>Prints a helpful message then quits.</p>
  </dd>

  <dt><code>--login_url=<i>...</i></code></dt>
  <dd>
    <p>The relative URL to use for the Users sign-in page.  Default is <code>/_ah/login</code>.</p>
  </dd>

  <dt><code>--port=<i>...</i></code></dt>
  <dd>
    <p>The port number to use for the server.  Default is <code>8080</code>.</p>
  </dd>

  <dt><code>--address=<i>...</i></code></dt>
  <dd>
    <p>The host address to use for the server.  You may need to set this to be able to access the development server from another computer on your network.  An address of <code>0.0.0.0</code> allows both localhost access and hostname access.  Default is <code>localhost</code>.</p>
  </dd>
  
  <dt><code>--clear_datastore</code></dt>
  <dd>
    <p>Clears the datastore data and history files before starting the web server.</p>
  </dd>

  <dt><code>--require_indexes</code></dt>
  <dd>
    <p>Disables automatic generation of entries in the <code>index.yaml</code> file.  Instead, when the application makes a query that requires that its index be defined in the file and the index definition is not found, an exception will be raised, similar to what would happen when running on App Engine.</p>
  </dd>

  <dt><code>--smtp_host=<i>...</i></code></dt>
  <dd>
    <p>The hostname of the SMTP server to use for sending email messages.</p>
  </dd>

  <dt><code>--smtp_port=<i>...</i></code></dt>
  <dd>
    <p>The port number of the SMTP server to use for sending email messages.</p>
  </dd>

  <dt><code>--smtp_user=<i>...</i></code></dt>
  <dd>
    <p>The username to use with the SMTP server for sending email messages.</p>
  </dd>

  <dt><code>--smtp_password=<i>...</i></code></dt>
  <dd>
    <p>The password to use with the SMTP server for sending email messages.</p>
  </dd>

  <dt><code>--enable_sendmail</code></dt>
  <dd>
    <p>Uses the local computer's Sendmail installation for sending email messages.</p>
  </dd>

  <dt><code>--debug_imports</code></dt>
  <dd>
    <p>Prints debugging messages related to importing modules, including search paths and errors.</p>
  </dd>

</dl>



      </div><!-- end gc-pagecontent -->
   </div><!-- end gooey wrapper -->

    </div> <!-- end codesite content -->

<div id="gc-footer" dir="ltr">
  <div class="text">
    
      <div class="notice"><div id="notice" style="text-align: center; border: 1em 0em 1em 0em">
  Except as otherwise <a
  href="http://code.google.com/policies.html#restrictions">noted</a>,
  the content of this page is licensed under the <a rel="license"
  href="http://creativecommons.org/licenses/by/2.5/">Creative Commons
  Attribution 2.5 License</a>, and code samples are licensed under the
  <a rel="license" href="http://www.apache.org/licenses/LICENSE-2.0">Apache
  2.0 License</a>.
<!-- <rdf:RDF xmlns="http://web.resource.org/cc/" 
              xmlns:dc="http://purl.org/dc/elements/1.1/"
              xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  <Work rdf:about="">
    <license rdf:resource="http://creativecommons.org/licenses/by/2.5/" />
  </Work>
  <License rdf:about="http://creativecommons.org/licenses/by/2.5/">
    <permits rdf:resource="http://web.resource.org/cc/Reproduction"/>
    <permits rdf:resource="http://web.resource.org/cc/Distribution"/>
    <requires rdf:resource="http://web.resource.org/cc/Notice"/>
    <requires rdf:resource="http://web.resource.org/cc/Attribution"/>
    <permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"/>
  </License>
</rdf:RDF> -->
</div>
Java is a registered trademark of Sun Microsystems, Inc.</div>
    
    &copy;2009 Google -
    <a href="http://code.google.com">Code Home</a> -
    <a href="http://www.google.com/accounts/TOS">Terms of Service</a> -
    <a href="http://www.google.com/privacy.html">Privacy Policy</a> -
    <a href="http://code.google.com/more">Site Directory</a>
    <br /> <br />
    Google Code offered in:
    <a href="http://code.google.com/intl/en">English</a> -
    <a href="http://code.google.com/intl/es">Español</a> -
    <a href="http://code.google.com/intl/ja">日本語</a> -
    <a href="http://code.google.com/intl/ko">한국어</a> -
    <a href="http://code.google.com/intl/pt-BR">Português</a> -
    <a href="http://code.google.com/intl/ru">Pусский</a> -
    <a href="http://code.google.com/intl/zh-CN">中文(简体)</a> -
    <a href="http://code.google.com/intl/zh-TW">中文(繁體)</a>
  </div>
</div><!-- end gc-footer -->

</div><!-- end gc-containter -->

<script type="text/javascript">CODESITE_CSITimer['load'].tick('ats');</script>
<script src="../../../../js/codesite_tail.pack.04102009.js" type="text/javascript"></script>






  </body>
</html>


